﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                assembly="KuaJing.Commodity"
				        namespace="KuaJing.Commodity.Domain">

  <class name="Category" table="Commodity_Category">
    <id name="Id" access="field.camelcase" type="Int32" column="CategoryId">
      <generator class="native" />
    </id>
    <version name="Version" access="field.camelcase" />

    <property name="Name" />
    <many-to-one name="Parent" class="KuaJing.Commodity.Domain.Category,KuaJing.Commodity" column="ParentId" />
    <set name="Children" inverse="true" cascade="all">
      <key column="ParentId" foreign-key="FK_Parent_Children" />
      <one-to-many  class="Category"/>
    </set>
    <set name="Goodses" cascade="save-update">
      <key column="CategoryId" foreign-key="FK_Category_Goods" />
      <one-to-many  class="Category"/>
    </set>
    <property name="CreatedTime" access="field.camelcase" />
    <property name="CreatedUserName" access="field.camelcase" />
    <property name="ModifiedTime" access="field.camelcase" />
    <property name="ModifiedUserName" access="field.camelcase" />
    <property name="AccessedTime" access="field.camelcase" />
    <property name="AccessedUserName" access="field.camelcase" />
    <property name="Memo" />
    <property name="IsInvalid" />

  </class>

</hibernate-mapping>


